package com.foreknow.demo2;

import javax.print.DocFlavor;
import java.util.Scanner;

public class Test6 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入消费金额:");
        double money = input.nextDouble();
        if(money<50){
            System.out.println("消费金额不足,无法参加该活动");
            System.exit(0);
        }else {
            System.out.println("是否参加优惠换购活动:");
            System.out.println("1.满50元,加2元换购百事可乐饮料一瓶");
            System.out.println("2.满100元,加3元换购500ml可乐一瓶");
            System.out.println("3.满100元,加10元换购5公斤面粉");
            System.out.println("4.满200元,加10元换购一个苏泊尔炒锅");
            System.out.println("5.满200元,加20元换购fender电吉他");
        }
        System.out.println("请输入:");
        int num = input.nextInt();
        int addmoney = 0;
        String goods = "无";
        switch (num){
            case 1:
                    addmoney = 2;
                    goods = "500ml可乐一瓶";
                break;
            case 2:
                    addmoney = 3;
                    goods = "百事可乐饮料一瓶";
                break;
            case 3:
                    addmoney = 10;
                    goods ="5公斤面粉";
                break;
            case 4:
                    addmoney = 10;
                    goods ="苏泊尔炒锅";
                break;
            case 5:
                    addmoney = 20;
                    goods ="fender电吉他";
                break;
        }
        money += addmoney;
        System.out.println("本次消费总金额:"+money+"元");
        System.out.println("成功换购:"+goods);
    }
}
